var pwd=false,again=false;
var parentl = $(window.parent.document).find('#vague');
var hint = parentl.children('#hint');
$('#pwd').blur(function () {
    var text = $(this).val();
    var pattern = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
    if (!pattern.test(text)) {
        $(this).next().text("密码为6-20位数字字母组合！").css("color", "#ff5722");
       pwd = false;
    } else {
        $(this).next().text("√ 输入密码有效").css("color", "#5ce078");
        pwd = true;
    }
})
$('#again').blur(function () {
    var pwd = $('#pwd').val();
    var text = $(this).val();
    if(pwd!=""){
    if (pwd == text) {
        $(this).next().text("√ 输入密码一致").css("color", "#5ce078");
        again = true;
    } else {
        $(this).next().text("两次密码不一致！").css("color", "#ff5722");
        again = false;
    }
    }
});
$('button').click(function(){
    if(pwd==true&&again==true){
      new Ajax("/my/updata.jsp").keyvalue($('#telform').serializeArray()).get(function(data){
          if(data==1){
            hint.empty();
            parentl.show();
            hint.html("<img src='../img/dui.png'/><span>&nbsp&nbsp修改成功！</span>");
              document.location="/my/sonaccount.jsp";
          }
      })
    }
})
